/*
 *  Node.h
 *  SypXIPhone
 *
 *  Created by Luv Khemani on 5/13/10.
 *  Copyright 2010 Luv Khemani. All rights reserved.
 *
 */

#pragma once
#ifndef SYPX_NODE
#define SYPX_NODE

#include "Types.h"

namespace SypX {
	
	///A Node represents any object that has to be represented in the 3D scene.
	///It merely consists of a 4x4 matrix to represent the objects transformation information
	///in the 3D world. In the future, Node may be expanded to support parent/child relationships
	///and possibly other advanced features
	class SYPXAPI Node 
	{
	public:
		Node();
		~Node();
		///Sets Position of this Node (x,y,z)
		void setPosition(const Vec3& pos);
		///Sets Position of this Node (x,y)
		void setPosition(const Vec2& pos);
		///Offsets Node's current position by the vector passed in
		void offsetPosition(const Vec3& pos);
		///Offsets Node's current position by the vector passed in
		void offsetPosition(const Vec2& pos);
		///Returns a reference to the position Vector4 in the transformation matrix.
		///The 4th(W) component can be ignored for most cases
		const Vec4& getPositionRef();	
		///Sets this Node's parent Node. Node's current transformation will be used
		void setParent(Node* p);
		///Returns a const reference to the Transformation Matrix of this Node
		const Mat4& getTransformMatrix();
	private:
		///The absolute transformation matrix for this Node. This is ultimately used for rendering/positioning
		Mat4 transform;
		Mat4 relative;
		Node* parent;
		std::vector<Node*> children;		
		
	};
	
}
#endif